<template>
  <div>
    <div class="chart-box" id="main"></div>
  </div>
</template>

<script setup name="Test">
import { onMounted } from 'vue';
import * as echarts from 'echarts';

const drawChart = () => {
  let myChart = echarts.init(document.getElementById('main'));
  // 初始化图表
  let option = {
  }

  option && myChart.setOption(option);
}

onMounted(() => {
  console.log('onMounted...');
  // 指定图表的配置项
  drawChart();
});
</script>

<style lang="scss" scoped>
.chart-box {
  width: 600px;
  height: 450px;
}
</style>
